home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Ham Radio
/
Ham Radio CD-ROM (Emerald Software) (1995).ISO
/
misc
/
hamutil2
/
s-to-y.bas
< prev
next >
Wrap
BASIC Source File
|
1979-12-31
|
3KB
|
79 lines
100 CLS :REM "S-TO-Y"
110 PRINT TAB(26);"**** S to Y CONVERSION ****"
120 REM V.HEESEN-1985
130 PRINT :PRINT "THIS PROGRAM CONVERTS S-PARAMETERS TO Y-PARAMETERS."
140 PI=4*ATN(1) :RAD=180/PI
150 PRINT :BEEP :PRINT "HARD COPY REQUIRED? (Y/N)"
160 P$=INKEY$ :IF P$="" THEN 160
170 IF P$="N" THEN 220
180 IF P$<>"Y" THEN 160
190 LPRINT :LPRINT TAB(15);"*** CONVERSION OF S-PARAMETERS TO Y-PARAMETERS ***"
200 LPRINT :LPRINT "DEVICE:__________CONDITIONS:________________________";
210 LPRINT "Freq:_________Date:_________" :LPRINT
220 PRINT :BEEP :INPUT "S11(M,P)=";AM,APP :AP=APP/RAD
230 PRINT :BEEP :INPUT "S12(M,P)=";BM,BPP :BP=BPP/RAD
240 PRINT :BEEP :INPUT "S21(M,P)=";CM,CPP :CP=CPP/RAD
250 PRINT :BEEP :INPUT "S22(M,P)=";DM,DPP :DP=DPP/RAD
260 IF P$<>"Y" THEN 290
270 LPRINT "S11=";AM;",";APP;TAB(20);"S12=";BM;",";BPP;TAB(40);
280 LPRINT "S21=";CM;",";CPP;TAB(60);"S22=";DM;",";DPP
290 V1=1+(AM*COS(AP)) :V2=AM*SIN(AP)
300 V3=SQR((V1^2)+(V2^2)) :V4=2*ATN(V2/(V3+V1))
310 V1=1+(DM*COS(DP)) :V2=DM*SIN(DP)
320 V5=SQR((V1^2)+(V2^2)) :V6=2*ATN(V2/(V5+V1))
330 V1=V5*V3 :V2=V6+V4
340 V8=BM*CM :V9=BP+CP
350 V3=(V1*COS(V2))-(V8*COS(V9))
360 V4=(V1*SIN(V2))-(V8*SIN(V9))
370 U1=SQR((V3^2)+(V4^2)) :U2=2*ATN(V4/(U1+V3))
380 V1=1+(DM*COS(DP)) :V2=DM*SIN(DP)
390 V3=SQR((V1^2)+(V2^2)) :V4=2*ATN(V2/(V3+V1))
400 V1=1-(AM*COS(AP)) :V2=-AM*SIN(AP)
410 V5=SQR((V1^2)+(V2^2)) :V6=2*ATN(V2/(V5+V1))
420 V1=V5*V3 :V2=V6+V4
430 V8=BM*CM :V9=BP+CP
440 V3=V8*COS(V9)+V1*COS(V2)
450 V4=V8*SIN(V9)+V1*SIN(V2)
460 U3=SQR((V3^2)+(V4^2)) :U4=2*ATN(V4/(U3+V3))
470 U5=-2*BM :U6=-2*CM
480 V1=1+(AM*COS(AP)) :V2=AM*SIN(AP)
490 V3=SQR((V1^2)+(V2^2)) :V4=2*ATN(V2/(V3+V1))
500 V1=1-(DM*COS(DP)) :V2=-DM*SIN(DP)
510 V5=SQR((V1^2)+(V2^2)) :V6=2*ATN(V2/(V5+V1))
520 V1=V5*V3 :V2=V6+V4
530 V8=BM*CM :V9=BP+CP
540 V3=V8*COS(V9)+V1*COS(V2)
550 V4=V8*SIN(V9)+V1*SIN(V2)
560 U7=SQR((V3^2)+(V4^2)) :U8=2*ATN(V4/(U7+V3))
570 AM=U3/U1 :AP=U4-U2
580 M11=AM*COS(AP) :P11=AM*SIN(AP)
590 IF P11<0 THEN A$="-" ELSE A$="+"
600 M11=INT(M11*2000)/100 :P11=INT(P11*200)/10
610 IF ABS(M11)>99 THEN M11=INT(M11)
620 BM=U5/U1 :BP=BP-U2
630 M12=BM*COS(BP) :P12=BM*SIN(BP)
640 IF P12<0 THEN B$="-" ELSE B$="+"
650 M12=INT(M12*2000)/100 :P12=INT(P12*200)/10
660 IF ABS(M12)>99 THEN M12=INT(M12)
670 CM=U6/U1 :CP=CP-U2
680 M21=CM*COS(CP) :P21=CM*SIN(CP)
690 IF P21<0 THEN C$="-" ELSE C$="+"
700 M21=INT(M21*2000)/100 :P21=INT(P21*200)/10
710 IF ABS(M21)>99 THEN M21=INT(M21)
720 DM=U7/U1 :DP=U8-U2
730 M22=DM*COS(DP) :P22=DM*SIN(DP)
740 IF P22<0 THEN D$="-" ELSE D$="+"
750 M22=INT(M22*2000)/100 :P22=INT(P22*200)/10
760 IF M22>99 THEN M22=INT(M22)
770 PRINT :PRINT "Y11=";M11;A$;"J"ABS(P11)
780 PRINT :PRINT "Y12=";M12;B$;"J";ABS(P12)
790 PRINT :PRINT "Y21=";M21;C$;"J";ABS(P21)
800 PRINT :PRINT "Y22=";M22;D$;"J";ABS(P22)
810 IF P$<>"Y" THEN 840
820 LPRINT:LPRINT "Y11=";M11;A$;"J";ABS(P11);TAB(20);"Y12=";M12;B$;"J";ABS(P12);
830 LPRINT TAB(40);"Y21=";M21;C$;"J";ABS(P21);TAB(60);"Y22=";M22;D$;"J";ABS(P22)
840 CLOSE #1 :PRINT :PRINT "CONTINUE? (Y/N)"
850 E$=INKEY$ :IF E$="" THEN 850
860 IF E$="Y" THEN 100
870 IF E$<>"N" THEN 850 ELSE END